package cn.com.surker.workcon.service.siwei;

import cn.com.surker.base.system.entity.SysLine;
import cn.com.surker.util.StringUtils;
import cn.com.surker.workcon.common.GKJDBCService;
import cn.com.surker.workcon.common.ProDelEnum;
import cn.com.surker.workcon.service.ProdDelService;
import cn.com.surker.workcon.service.bcs.common.BCSDelFlagEnum;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 上海思维删除派单数据 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2024-09-26
 */
public class ProdDelServiceImpl extends GKJDBCService implements ProdDelService {

	public int insert(Long lineId, Long dispatchId, String dispatchCode) {
		if (lineId == null || dispatchId == null || StringUtils.isBlank(dispatchCode)) {
			return -1;
		}
		//	获取生产线
		SysLine line = getLine(lineId);
		if (line == null) {
			return -1;
		}
		JdbcTemplate lineJdbcTemp = getLineJdbcTemp(line);
		if (lineJdbcTemp == null) {
			return -1;
		}
		//	插入sql
		String insertSql = "insert into TMsgA (FMsgType,FDateTime,FA4) values (?,?,?)";
		//	拼接参数
		Object[] params = {11, new Date(), dispatchId};
		//	开启事务
		beginTransaction(lineId);
		//	插入数据
		int insert = lineJdbcTemp.update(insertSql, params);
		return insert;
	}

	public Integer selectByDisId(Long lineId, Long dispatchId) {
		//	上海思维没有返回删除是否成功的接口
		return null;
	}

	public Integer deleteByDisId(Long lineId, Long dispatchId) {
		return -1;
	}
}


